package com.haiya.identityaccess.infrastructure.persistence.mybatis.translation;

import com.haiya.identityaccess.domain.identity.model.Group;
import com.haiya.identityaccess.domain.identity.model.TenantId;
import com.haiya.identityaccess.infrastructure.persistence.mybatis.datamodel.DataGroup;

/**
 * @author qiaoguoqiang
 */
public class GroupTranslate {
    public static Group toDomainEntity(DataGroup dataGroup) {
        return new Group(
                new TenantId(dataGroup.getTenantIdId()),
                dataGroup.getName(),
                dataGroup.getDescription());
    }

    public static DataGroup toDataEntity(Group group) {
        return new DataGroup(
                group.tenantId().id(),
                group.name(),
                group.description());
    }
}
